/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * VergelijkerGUI.java
 *
 * Created on 9-sep-2011, 15:21:11
 */
package nl.maxato.gui;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.io.File;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JTable;
import javax.swing.UIManager;
import javax.swing.table.TableColumn;

import nl.maxato.controller.Controller;
import nl.maxato.domain.Differences;
import nl.maxato.modellen.DifferencesTableModel;
import nl.maxato.util.ConfigurationFile;
import nl.maxato.util.ParameterNames;

/**
 *
 * @author Danny
 */
public class CompareAthletesGUI extends JFrame {

    Controller controller;
    ResourceBundle rb;
    String language;
    String country;
    Locale locale;
    List<String> s;
    DifferencesTableModel atm;
    ArrayList<Date> a = new ArrayList<Date>();
    DateFormat df = new SimpleDateFormat("MM-dd-yyyy");
    java.util.Date date = new java.util.Date();
    DateCompare compare = new DateCompare();
    ConfigurationFile cf;

    /** Creates new form VergelijkerGUI */
    public CompareAthletesGUI() {
        initComponents();
        controller = new Controller();
        cf = new ConfigurationFile();
        translateGUI(controller.getLanguague(cf.getLanguage()));
        fillComparesComboboxen();
    }

    private void fillComparesComboboxen() {
        File folder = new File("xml/athletes/");
        File[] listOfFiles = folder.listFiles();
        for (int i = 0; i < listOfFiles.length; i++) {
            if (listOfFiles[i].isFile()) {
                try {
                    String datum = listOfFiles[i].getName();
                    datum = datum.substring(0, 10);
                    date = df.parse(datum);
                    a.add(date);
                } catch (ParseException ex) {
                    Logger.getLogger(CompareAthletesGUI.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        }
        Collections.sort(a, compare);
        for (int j = 0; j < a.size(); j++) {
            date = new Date(a.get(j).getTime());
            jCombobox_ListWithAthletesFiles1.addItem(df.format(date));
            jCombobox_ListWithAthletesFiles2.addItem(df.format(date));
        }
    }

    private void translateGUI(ResourceBundle b) {
        rb = b;
        translateComboboxSortOnType(b);
        jButton_VergelijkActionPerformed(null);
        //Title
        this.setTitle(b.getString("MAXATO_COMPARE_ATHLETES"));

        //Menu
        jMenu_File.setText(b.getString("FILE"));
        jMenu_Languague.setText(b.getString("LANGUAGE"));

        //MenuItems
        jMenuItem_Afsluiten.setText(b.getString("CLOSE"));

        jMenuItem_English.setText(ParameterNames.languageENGLISH);
        jMenuItem_Dutch.setText(ParameterNames.languageDUTCH);
        jMenuItem_Polish.setText(ParameterNames.languagePOLISH);
        jMenuItem_Deutsch.setText(ParameterNames.languageDEUTSCH);
        jMenuItem_Francais.setText(ParameterNames.languageFRANCAIS);
        jMenuItem_Espanol.setText(ParameterNames.languageESPANOL);
        jMenuItem_Portuguese.setText(ParameterNames.languagePORTUGUESE);
        jMenuItem_Czech.setText(ParameterNames.languageCZECH);
        jMenuItem_Greek.setText(ParameterNames.languageGREEK);
        jMenuItem_Italian.setText(ParameterNames.languageITALIAN);
        jMenuItem_Estonian.setText(ParameterNames.languageESTONIAN);
        jMenuItem_Russian.setText(ParameterNames.languageRUSSIAN);
        jMenuItem_Hungarian.setText(ParameterNames.languageHungarian);
        
        //JLabel
        jLabel_VergelijkDatum1.setText(b.getString("SELECT_DATE") + ":");
        jLabel_VergelijkDatum2.setText(b.getString("SELECT_DATE") + ":");
        jLabel_SorterenOp.setText(b.getString("SORT_BY") + ":");

        //Button
        jButton_Vergelijk.setText(b.getString("COMPARE"));
//        if (atm != null) {
//            atm.setColumnNames(b.getString("NAME"), b.getString("SORT"), b.getString("OLD_VALUE"), b.getString("NEW_VALUE"), b.getString("DIFFERENCE"));
//        }


    }

    /**
     * 0 - Niet sorteren
     * 1 - Leeftijd
     * 2 - Loon
     * 3 - Fans
     * 4 - Lengte
     * 5 - Gewicht
     * 6 - MAXID
     * 7 - Form
     * 8 - Ervaring
     * 9 - Kracht
     * 10 - Uithouding
     * 11 - Snelheid
     * 12 - Lenigheid
     * 13 - Springen
     * 14 - Werpen
     * 15 - Specialiteit1
     * 16 - Specaliteit2
     */
    private void translateComboboxSortOnType(ResourceBundle rb) {
        JComboBox cb = jComboBox_SortOnType;
        cb.removeAllItems();
        cb.insertItemAt(rb.getString("DONT_SORT"), 0);
        cb.insertItemAt(rb.getString("AGE"), 1);
        cb.insertItemAt(rb.getString("WAGE"), 2);
        cb.insertItemAt(rb.getString("FANS"), 3);
        cb.insertItemAt(rb.getString("HEIGHT"), 4);
        cb.insertItemAt(rb.getString("WEIGHT"), 5);
        cb.insertItemAt(rb.getString("MAXID"), 6);
        cb.insertItemAt(rb.getString("FORM"), 7);
        cb.insertItemAt(rb.getString("EXPERIENCE"), 8);
        cb.insertItemAt(rb.getString("STRENGHT"), 9);
        cb.insertItemAt(rb.getString("STAMINA"), 10);
        cb.insertItemAt(rb.getString("SPEED"), 11);
        cb.insertItemAt(rb.getString("AGILITY"), 12);
        cb.insertItemAt(rb.getString("JUMP"), 13);
        cb.insertItemAt(rb.getString("THROWING"), 14);
        cb.insertItemAt(rb.getString("SPECIALTY1"), 15);
        cb.insertItemAt(rb.getString("SPECIALTY2"), 16);
        cb.setSelectedIndex(0);
        fillList(rb);
    }

    private void fillList(ResourceBundle rb) {
        s = new ArrayList<String>();
        s.add(rb.getString("DONT_SORT"));
        s.add(rb.getString("AGE"));
        s.add(rb.getString("WAGE"));
        s.add(rb.getString("FANS"));
        s.add(rb.getString("HEIGHT"));
        s.add(rb.getString("WEIGHT"));
        s.add(rb.getString("MAXID"));
        s.add(rb.getString("FORM"));
        s.add(rb.getString("EXPERIENCE"));
        s.add(rb.getString("STRENGHT"));
        s.add(rb.getString("STAMINA"));
        s.add(rb.getString("SPEED"));
        s.add(rb.getString("AGILITY"));
        s.add(rb.getString("JUMP"));
        s.add(rb.getString("THROWING"));
        s.add(rb.getString("SPECIALTY1"));
        s.add(rb.getString("SPECIALTY2"));
    }

    /** Returns an ImageIcon, or null if the path was invalid. */
    protected static ImageIcon createImageIcon(String path) {
        //  java.net.URL imgURL = path;
        if (path != null) {
            return new ImageIcon(path);
        } else {
            System.err.println("Couldn't find image file: " + path);
            return null;
        }
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {
        setResizable(false);
        java.awt.Dimension screenSize = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        setBounds((screenSize.width - 835) / 2, (screenSize.height - 600) / 2, 835, 600);
        jCombobox_ListWithAthletesFiles1 = new javax.swing.JComboBox();
        jLabel_VergelijkDatum1 = new javax.swing.JLabel();
        jCombobox_ListWithAthletesFiles2 = new javax.swing.JComboBox();
        jLabel_VergelijkDatum2 = new javax.swing.JLabel();
        jButton_Vergelijk = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jComboBox_SortOnType = new javax.swing.JComboBox();
        jLabel_SorterenOp = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu_File = new javax.swing.JMenu();
        ImageIcon icon;
        icon = createImageIcon("img/close.png");
        jMenuItem_Afsluiten = new javax.swing.JMenuItem(icon);
        jMenu_Languague = new javax.swing.JMenu();

        icon = createImageIcon("img/gb.png");
        jMenuItem_English = new javax.swing.JMenuItem(icon);
        icon = createImageIcon("img/nl.png");
        jMenuItem_Dutch = new javax.swing.JMenuItem(icon);

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel_VergelijkDatum1.setText("jLabel1");

        jLabel_VergelijkDatum2.setText("jLabel1");

        jButton_Vergelijk.setText("jButton1");
        jButton_Vergelijk.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton_VergelijkActionPerformed(evt);
            }
        });

        jTable1.setModel(new javax.swing.table.DefaultTableModel());
        jScrollPane1.setViewportView(jTable1);

        jLabel_SorterenOp.setText("Sorteren op");

        jMenu_File.setText("File");

        jMenuItem_Afsluiten.setText("Afsluiten");
        jMenuItem_Afsluiten.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_AfsluitenActionPerformed(evt);
            }
        });
        jMenu_File.add(jMenuItem_Afsluiten);

        jMenuBar1.add(jMenu_File);

        jMenu_Languague.setText("Language");

        jMenuItem_English.setText("Engels");
        jMenuItem_English.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_EngelsActionPerformed(evt);
            }
        });
        jMenuItem_Dutch.setText("Nederlands");
        jMenuItem_Dutch.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_NederlandsActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/de.png");
        jMenuItem_Deutsch = new JMenuItem(icon);
        jMenuItem_Deutsch.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_DEUTSCHActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/hu.png");
        jMenuItem_Hungarian = new JMenuItem(icon);
        jMenuItem_Hungarian.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_HUNGARIANActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/et.png");
        jMenuItem_Estonian = new JMenuItem(icon);
        jMenuItem_Estonian.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_ESTONIANActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/ru.png");
        jMenuItem_Russian = new JMenuItem(icon);
        jMenuItem_Russian.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_RUSSIANActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/fr.png");
        jMenuItem_Francais = new JMenuItem(icon);
        jMenuItem_Francais.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_FRANCAISActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/es.png");
        jMenuItem_Espanol = new JMenuItem(icon);
        jMenuItem_Espanol.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_ESPANOLActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/pl.png");
        jMenuItem_Polish = new JMenuItem(icon);
        jMenuItem_Polish.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_PolishActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/pt.png");
        jMenuItem_Portuguese = new JMenuItem(icon);
        jMenuItem_Portuguese.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_PortugueseActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/gr.png");
        jMenuItem_Greek = new JMenuItem(icon);
        jMenuItem_Greek.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_GREEKActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/cz.png");
        jMenuItem_Czech = new JMenuItem(icon);
        jMenuItem_Czech.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_CZECHActionPerformed(evt);
            }
        });
        icon = createImageIcon("img/it.png");
        jMenuItem_Italian = new JMenuItem(icon);
        jMenuItem_Italian.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem_ITALIANActionPerformed(evt);
            }
        });
        jMenu_Languague.add(jMenuItem_Czech);
        jMenu_Languague.add(jMenuItem_Deutsch);
        jMenu_Languague.add(jMenuItem_Estonian);
        jMenu_Languague.add(jMenuItem_English);
        jMenu_Languague.add(jMenuItem_Greek);
        jMenu_Languague.add(jMenuItem_Espanol);
        jMenu_Languague.add(jMenuItem_Francais);
        jMenu_Languague.add(jMenuItem_Hungarian);
        jMenu_Languague.add(jMenuItem_Italian);
        jMenu_Languague.add(jMenuItem_Dutch);
        jMenu_Languague.add(jMenuItem_Polish);
        jMenu_Languague.add(jMenuItem_Portuguese);
        jMenu_Languague.add(jMenuItem_Russian);

        jMenuBar1.add(jMenu_Languague);

//        JPanel j = new JPanel();
//        j.setSize(830, 40);
//        j.setPreferredSize(new Dimension(830, 40));
//        j.setLayout(new GridLayout(2, 4));
//
//        j.add(jLabel_VergelijkDatum1);
//        j.add(jLabel_VergelijkDatum2);
//        j.add(jLabel_SorterenOp);
//        j.add(new JLabel(""));
//
//        j.add(jCombobox_ListWithAthletesFiles1);
//        j.add(jCombobox_ListWithAthletesFiles2);
//        j.add(jComboBox_SortOnType);
//        j.add(jButton_Vergelijk);
//
        setJMenuBar(jMenuBar1);
//        this.getContentPane().add(BorderLayout.NORTH, jMenuBar1);
//        this.getContentPane().add(BorderLayout.CENTER, j);
//        this.getContentPane().add(BorderLayout.SOUTH, jScrollPane1);
        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 822, Short.MAX_VALUE).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jCombobox_ListWithAthletesFiles1, javax.swing.GroupLayout.PREFERRED_SIZE, 219, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel_VergelijkDatum1)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(jCombobox_ListWithAthletesFiles2, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jLabel_VergelijkDatum2)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addComponent(jComboBox_SortOnType, javax.swing.GroupLayout.PREFERRED_SIZE, 233, javax.swing.GroupLayout.PREFERRED_SIZE).addGap(10, 10, 10).addComponent(jButton_Vergelijk, javax.swing.GroupLayout.PREFERRED_SIZE, 97, javax.swing.GroupLayout.PREFERRED_SIZE)).addComponent(jLabel_SorterenOp)).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 10, Short.MAX_VALUE))).addContainerGap()));
        layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addGap(14, 14, 14).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING).addGroup(layout.createSequentialGroup().addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jLabel_VergelijkDatum2).addComponent(jLabel_SorterenOp).addComponent(jLabel_VergelijkDatum1)).addGap(26, 26, 26)).addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE).addComponent(jCombobox_ListWithAthletesFiles1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jCombobox_ListWithAthletesFiles2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jComboBox_SortOnType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE).addComponent(jButton_Vergelijk))).addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED).addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 510, Short.MAX_VALUE).addGap(0, 0, 0)));


    }// </editor-fold>                        

    private void jButton_VergelijkActionPerformed(java.awt.event.ActionEvent evt) {
        try {
            List<Differences> dfs = new ArrayList<Differences>();
            DateFormat formatter;
            Date date1;
            Date date2;
            formatter = new SimpleDateFormat("MM-dd-yyyy");
            date1 = (Date) formatter.parse(jCombobox_ListWithAthletesFiles1.getSelectedItem().toString());
            date2 = (Date) formatter.parse(jCombobox_ListWithAthletesFiles2.getSelectedItem().toString());
            if (date1.before(date2)) {
                dfs = controller.compareXMLFiles((controller.getAthletesByDate(jCombobox_ListWithAthletesFiles1.getSelectedItem().toString())), (controller.getAthletesByDate(jCombobox_ListWithAthletesFiles2.getSelectedItem().toString())), jComboBox_SortOnType.getSelectedIndex(), s);
            } else {
                dfs = controller.compareXMLFiles((controller.getAthletesByDate(jCombobox_ListWithAthletesFiles2.getSelectedItem().toString())), (controller.getAthletesByDate(jCombobox_ListWithAthletesFiles1.getSelectedItem().toString())), jComboBox_SortOnType.getSelectedIndex(), s);
            }
            setComparesTable(dfs);
        } catch (Exception ex) {
        }

    }

    public void setComparesTable(List<Differences> dfs) {
        if (!dfs.isEmpty()) {
            atm = new DifferencesTableModel(dfs);
            atm.setColumnNames(rb.getString("NAME"), rb.getString("SORT"), rb.getString("OLD_VALUE"), rb.getString("NEW_VALUE"), rb.getString("DIFFERENCE"));
            jTable1.setModel(atm);
            jTable1.setAutoCreateRowSorter(true);
            jTable1.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            TableColumn column;
            for (int i = 0; i < 5; i++) {
                column = jTable1.getColumnModel().getColumn(i);
                column.setPreferredWidth(160);
            }
            jTable1.setVisible(true);
        } else {
            jTable1.setVisible(false);
        }
    }

    private void jMenuItem_ESTONIANActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("et"));
    }

    private void jMenuItem_RUSSIANActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("ru"));
    }

    private void jMenuItem_EngelsActionPerformed(java.awt.event.ActionEvent evt) {
        translateGUI(controller.getLanguague("en"));
    }

    private void jMenuItem_NederlandsActionPerformed(java.awt.event.ActionEvent evt) {
        translateGUI(controller.getLanguague("nl"));
    }

    private void jMenuItem_PortugueseActionPerformed(java.awt.event.ActionEvent evt) {
        translateGUI(controller.getLanguague("pt"));
    }

    private void jMenuItem_PolishActionPerformed(java.awt.event.ActionEvent evt) {
        translateGUI(controller.getLanguague("pl"));
    }

    private void jMenuItem_DEUTSCHActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("de"));
    }

    private void jMenuItem_FRANCAISActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("fr"));
    }

    private void jMenuItem_ESPANOLActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("es"));
    }

    private void jMenuItem_ITALIANActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("it"));
    }

    private void jMenuItem_GREEKActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("el"));
    }

    private void jMenuItem_CZECHActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("cs"));
    }

    private void jMenuItem_HUNGARIANActionPerformed(ActionEvent evt) {
        translateGUI(controller.getLanguague("hu"));
    }    

    private void jMenuItem_AfsluitenActionPerformed(java.awt.event.ActionEvent evt) {
        this.dispose();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        //zet de GUI om in Windows-look
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (Exception e) {
            System.out.println("Unable to load Windows look and feel");
        }


        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new CompareAthletesGUI().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton_Vergelijk;
    private javax.swing.JComboBox jComboBox_SortOnType;
    private javax.swing.JComboBox jCombobox_ListWithAthletesFiles1;
    private javax.swing.JComboBox jCombobox_ListWithAthletesFiles2;
    private javax.swing.JLabel jLabel_SorterenOp;
    private javax.swing.JLabel jLabel_VergelijkDatum1;
    private javax.swing.JLabel jLabel_VergelijkDatum2;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem_Afsluiten;
    private javax.swing.JMenuItem jMenuItem_English;
    private javax.swing.JMenuItem jMenuItem_Dutch;
    private javax.swing.JMenuItem jMenuItem_Polish;
    private javax.swing.JMenu jMenu_File;
    private javax.swing.JMenu jMenu_Languague;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    JMenuItem jMenuItem_Deutsch;
    JMenuItem jMenuItem_Francais;
    JMenuItem jMenuItem_Espanol;
    JMenuItem jMenuItem_Portuguese;
    private javax.swing.JMenuItem jMenuItem_Italian;
    private javax.swing.JMenuItem jMenuItem_Czech;
    private javax.swing.JMenuItem jMenuItem_Greek;
    private javax.swing.JMenuItem jMenuItem_Estonian;
    private javax.swing.JMenuItem jMenuItem_Russian;
    private javax.swing.JMenuItem jMenuItem_Hungarian;
    // End of variables declaration                   
}

class DateCompare implements Comparator<Date> {

    public int compare(Date one, Date two) {
        //return one.compareTo(two);
        return two.compareTo(one);
    }
}